home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / EGAVGA.SWG / 0153_Planar 16 Color Mode Plot.pas < prev    next >
Pascal/Delphi Source File  |  1995-03-03  |  2KB  |  97 lines

  1. {
  2. > I have not seen a correct SetPixel routine for a planar 16 color mode.  It
  3. > does not have to be fast or optimized, just working correctly so I can see
  4. > how it's done.
  5.  
  6. Well, I found something that you can fiddle around with, it's not exactly
  7. working (well, kind of), but it shows the principle... all the Ports are
  8. right, what's going in & out is right, just the FillChar needs to be fixed
  9. up to plot only a single pixel or group thereof.
  10. }
  11. Program Try_EGA;
  12. Uses CRT;
  13.  
  14. Var Scr:Byte Absolute $A000:0;
  15.     Loop:Word;
  16.  
  17. Procedure Mode_10;
  18. Inline($B8/$0d/$00/$CD/$10);{Intr $10, AX=$000D}
  19.  
  20. Procedure Write;
  21. Begin
  22.  {Write mode}
  23.  Port[$03CE]:=5;
  24.  Port[$03CF]:=Port[$03CF] And $FC;
  25. End;
  26.  
  27. Procedure Undo_Latches;
  28. Begin
  29.  If Scr=1 Then
  30.   Begin
  31.   End;
  32. End;
  33.  
  34. Procedure Bmp(Bmp:Byte);
  35. Begin
  36.  {Plane}
  37.  Port[$03CE]:=8;
  38.  Port[$03CF]:=Bmp;
  39. End;
  40.  
  41. Procedure Color(C:Word);
  42. Begin
  43.  PortW[$03CE]:=C*256;
  44.  PortW[$03CE]:=$0F01;
  45. End;
  46.  
  47. Procedure Show(Bm,Clr:Word);
  48. Begin
  49.  Bmp(Bm);
  50.  Color(Clr);
  51.  Undo_Latches;
  52.  FillChar(Scr,8000,$FF);
  53.  Delay(1000);
  54. End;
  55.  
  56. Begin
  57.  Mode_10;
  58.  Write;
  59.  
  60.  Delay(1000);
  61.  
  62.  Show($11,1);
  63.  Show($22,2);
  64.  Show($44,3);
  65.  Show($88,4);
  66.  Show($10,5);
  67.  Show($20,6);
  68.  Show($40,7);
  69.  Show($80,8);
  70.  
  71.  Delay(1000);
  72. End.
  73. {
  74.  
  75. Bmp says which pixels of any group of 8 is affected... the screen looks like
  76. this:
  77.  
  78. 1234567812345678123456781234567812345678.....
  79. 1234567812345678123456781234567812345678.....
  80. 1234567812345678123456781234567812345678.....
  81. .
  82. .
  83. .
  84.  
  85. Thus if you want the first & 3rd pixel green, do
  86. }
  87.  Color(Green);
  88.  Bmp(5);       {Bits 1 & 3 set}
  89.  Undo_Latches;
  90.  Mem[$A000:0]:=$FF; {I think}
  91. {
  92. I dont know what Undo_Latches does, but it seems to work...
  93.  
  94. BTW, I saw mention of a VESA unit you were writing, as a reward for this
  95. information.... do I qualify? I'm very interested....
  96. }
  97.